package com.hzy.fivepalace.wx.controller.api;

import com.hzy.fivepalace.common.util.TableDataInfo;
import com.hzy.fivepalace.wx.annotation.LoginUser;
import com.hzy.fivepalace.wx.controller.base.BaseController;
import com.hzy.fivepalace.wx.service.WxCouponsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * 优惠券服务
 */
@RestController
@RequestMapping("/wx/coupons")
@Validated
@Api(tags = "优惠券服务")
public class WxCouponsController extends BaseController {

    private static final Logger logger = LoggerFactory.getLogger(WxCouponsController.class);

    @Autowired
    private WxCouponsService couponsService;


    @GetMapping("/getUserCouponsList/v1_0_0")
    @ApiOperation(value = "用户优惠券列表")
    public TableDataInfo getActivityList(
            @LoginUser @ApiParam(hidden = true) Integer userId,
            @ApiParam(value = "状态：0未使用，1已失效", required = true) @RequestParam @NotNull Integer status,
            @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer page,
            @ApiParam(value = "分页大小", defaultValue = "10") @RequestParam(defaultValue = "10") Integer size
    ) {

        return couponsService.getUserCouponsList(page, size, status,userId);
    }

}
